//
// Created by 李传智 on 2018/4/12.
//

#ifndef ANDSDK_TEXTURE_H
#define ANDSDK_TEXTURE_H

#include <mutex>

enum TextureType {
    TEXTURE_YUV420P = 0, // y 4 u 1 v 1 = AV_PIX_FMT_YUV420P
    TEXTURE_NV12 = 25,   // y 4 uv 1 = AV_PIX_FMT_NV12
    TEXTURE_NV21 = 26    // y 4 vu 1 = AV_PIX_FMT_NV21
};

class Texture {

public:
    static Texture *create();

    // 初始化
    virtual bool init(void *window, int vWidth, int vHeight, int format) = 0;

    // 绘制
    virtual void draw(unsigned char *data[], int width, int height) = 0;

    virtual ~Texture() {};

    virtual void destroy() = 0;

    int format;

protected:

    Texture() {};

    // 窗口的大小, 绘制区域的大小，绘制的坐标
    int wWidth, wHeight, dWidth, dHeight, dx, dy;

    std::mutex mutex;
};

#endif //ANDSDK_TEXTURE_H
